Define the PLC Cycle

The cycle specification defines the number of cycles between successive executions of the programs.

  1. In the Project Explorer, expand the PLCClosed"Programmable Logic Controller" A Programmable Logic Controller, PLC, or Programmable Controller is a digital computer used for automation of industrial processes, such as control of machinery on factory assembly lines. Used to synchronize the flow of inputs from (physical) sensors and events with the flow of outputs to actuators and events node and right-click on the Programs item to open the contextual menu and select the Cycle command

Edit the Cycle

Figure 4-49: Edit the Cycle

The Cycle window allows the regulation of the following parameters: Period and Phase.

Define the Cycle

Figure 4-50: Define the Cycle

The cycle configuration dialog box is used to configure the programs priority into the Virtual Machine.

Column Description
Name

List of PLC programs grouped together by priority level. The priority defines the order of execution. The SFCClosed"Sequential function chart" It can be used to program processes that can be split into steps. The main components of SFC are: - Steps with associated actions - Transitions with associated logic conditions - Directed links between steps and transitions programs have a specific section as they must be grouped together.

High Priority means "executed before SFC", and Low Priority means "executed after SFC".

Check box Enables or disables the execution of the corresponding program.
Period

Defines how many cycles are set between two executions of the program.

You can define various sampling periods for programs of the application. Default period is "1" (the program is executed on each cycle).
Giving a slower period to some programs is an easy way to give higher priority to some other programs.

Phase

Defines an offset that enables you to dispatch slow programs among few cycles.

The goal of postponing the program execution is to reduce execution peak loads.

Example:
a program with period=2 and Phase=1 is executed each even cycle
a program with period=2 and Phase=0 is executed each odd cycle

Table 4-2: Cycle Parameters

In the High and Normal Priority sections, you can adjust the order of the programs with a drag-and-drop operation according to the expected sequence. In each section, the program on the top is executed first.

Select the program you want to set with a higher priority, then drag and drop it to the relevant priority level.

Figure 4-51: Change Priorities by Defining the Cycle

If all programs are with a Period set to 1, the KAS IDEClosed"Integrated development environment" An integrated development environment is a type of computer software that assists computer programmers in developing software. IDEs normally consist of a source code editor, a compiler and/or interpreter, build-automation tools, and a debugger is more loaded. The choice of the Period for the programs gives you the possibility to distribute the load of the application.

Tasking Model / Scheduling and Order of Execution.

How to specify the duration of a cycle

This parameter is defined in EtherCAT Master Settings.

Ensuring Variables are Exported

Program Organization Units (POUs) which contain variables (see "Map Variables to HMI") must be compiled in order for the variable to be exported. For example, in the following set of images we see a POUClosed"Programmable Organization Unit" An application is a list of programs. Programs are executed sequentially within the target cycle according to the order defined by the user and displayed in the Project View (UntitledST) with two variables, NewVar and NewVar1 and only NewVar1 is set to be exported (1). The POU, however, is not set to be executed in the Cycle dialog box (2). This will cause a compile error (3).


Figure 4-52: Example of a variable not being exported and the resulting compile error.